/*Copyright (C) 2013-2022 LZE*/
#include<bits/stdc++.h>
#define fo(x) freopen(#x".in", "r", stdin); freopen(#x".out", "w", stdout);
#define INF 0x7fffffff
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const int N = 3010;
const int M = 100010;
const int mod = 998244353;
ll T, n, m, k;
pair<ll, ll> p[N];
ll fast_pow(ll base, ll power, ll modnum) {
    ll ans = 1;
    while(power > 0) {
        if(power & 1) ans = ans * base % modnum;
        power >>= 1;
        base = base * base % modnum;
    }
    return ans % modnum;
}
ll inv(ll number) { return fast_pow(number, mod - 2, mod); }
ll mod_func(ll number) { return (number % mod + mod) % mod; }
int main() {
    scanf("%lld%lld", &n, &k);
    for(ll i = 1; i <= n; i++) {
        scanf("%lld%lld", &p[i].first, &p[i].second);
    }
    ll ans = 0, tmp1, tmp2;
    for(ll i = 1; i <= n; i++) {
        tmp1 = p[i].second % mod, tmp2 = 1;
        for(ll j = 1; j <= n; j++) {
            if(i != j) {
                tmp1 = tmp1 * mod_func(k - p[j].first) % mod;
                tmp2 = tmp2 * mod_func(p[i].first - p[j].first) % mod;
            }
        }
        ans += mod_func(tmp1 * inv(tmp2));
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}
